package com.finals.finalsscreen.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

import com.finals.finalsscreen.R;
import com.finals.finalsscreen.app.BaseApplication;
import com.finals.finalsscreen.phone.PhoneStateListen;
import com.finals.finalsscreen.util.NotificationUtil;

public class SplashScreenService extends Service {

	BaseApplication mApplication;

	PhoneStateListen mPhoneStateListen;

	NotificationUtil mNotificationUtil;

	@Override
	public void onCreate() {
		super.onCreate();
		mApplication = (BaseApplication) getApplication();
		mNotificationUtil = new NotificationUtil(this);
		String titleString = getResources().getString(R.string.app_name);
		String contenString = getResources().getString(R.string.app_name);
		mNotificationUtil.InitData(titleString, contenString);
		mNotificationUtil.Notification();
		mPhoneStateListen = new PhoneStateListen(mApplication);
		mPhoneStateListen.InitCallListener();
	}

	@Override
	public IBinder onBind(Intent intent) {
		return null;
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
		if (mNotificationUtil != null) {
			mNotificationUtil.CancelNotification();
		}
		if (mPhoneStateListen != null) {
			mPhoneStateListen.ReleaseCallListener();
		}
	}
}
